from GOToolKit.go_parser import *

if __name__ == "__main__":
	"""
	Contains a examples
	"""
	
	#create a new parser instance
	go = go_parser() 
	#by default it expects either GO OBO file -- go.obo or the GO XML file -- go.xml to be present in the path
	#if the file is present else where or with another name, use
	#go = go_parser(go_obo_filename)="obo_file_name_with_full_path"
	#go = go_parser(go_xml_filename="xml_file_name_with_full_path")
	#by default a dump file called go.dump is created in the current directory
	#to create it else whhere, use
	#go = go_parser(go_dump_filename="dump_file_name_with_full_path")

	#get information about a GO entry
	print go.get_go_object('0016818')
	print go.get_go_object('GO:0007563')
	#refer to the go_node class for more information about the object
	#the id can be of the form GO:XXXXXX or XXXXXX or an integer (i.e GO id without leading zeros)

	#get a go object for a given name
	print go.get_go_object(go.get_exact_id('regulation of eclosion'))
	
	#get all similar GO objects for the name given
	prob = go.get_prob_id('regulation of eclosion')
	for p in prob:
		print go.get_go_object(p)

	#get ancestor IDs of this node upto a depth 2
	ans = go.get_ancestors('0009899',2)
	for a in ans:
		print go.get_go_object(a)

	#see if they have any nodes in common
	print go.related(16838, 7563)
	#they are ancestors
	print go.related(9899, 16829, 5)
